﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DuLieu;
using ThaoTac;
using ThongTin;

namespace GiaoDien
{
    public partial class frmQuanLyNganhDaoTao : Form
    {
        public string ChucNang;
        public frmQuanLyNganhDaoTao( String ChucNang, NganhDaoTao_TT Nganh )
        {
            InitializeComponent();
            this.ChucNang = ChucNang;
            if (ChucNang.Equals("Sua"))
            {
                txtMaNganh.Text = Nganh.MaNganh;
                txtTenNganh.Text = Nganh.TenNganh;
                cboMaKhoa.Text = Nganh.MaKhoa;
                
            }
        }

        public frmQuanLyNganhDaoTao()
        {
            // TODO: Complete member initialization
        }
        public String MaNganh 
        {
            get { return txtMaNganh.Text; }
        }
        public String TenNganh
        {
            get { return txtTenNganh.Text; }
        }
        public String MaKhoa
        {
            get { return cboMaKhoa.Text; }
        }
        public event EventHandler addNew;

        private void btnXacNhan_KH_Click(object sender, EventArgs e)
        {

            EventHandler eh = addNew;
            if (eh != null)
                eh(this, e);
            if (this.ChucNang.Equals("Sua"))
            {
                this.Close(); 
            }
        }

        private void btnThoat_KH_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        
        private void frmQuanLyNganhDaoTao_Load(object sender, EventArgs e)
        {
            load();
        }
        private void load()
        {
            loadcombobox load = new loadcombobox();
            cboMaKhoa.DisplayMember = "MaKhoa";
            cboMaKhoa.DataSource = load.loadcombox("Khoa").Tables[0];
        }

    }
}
